// 配置请求对象
import axios from 'axios'
// 本地调试 dev 开发阶段
export const baseUrl = "http://localhost:3000";
// product 阶段
// https://www.fastmock.site/mock/759aba4bef0b02794e330cccc1c88555/beers/banners
// 设计模式
const axiosInstance = axios.create({
    baseURL:baseUrl
})

// 拦截器
// axiosInstance.interceptors.request.use(req=>{
//     console.log('开始请求...')
//     req.code = '1231212'
//     req.headers['Authorization'] = 
//         "Bearer" + localToken
//     return req
// },err => {

// });
axiosInstance.interceptors.response.use(
    res => res.data,
    err => {
        console.log(err,'网络错误')
    }
)

export { axiosInstance }